<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Favorite fruit with required attribute</title>
    <style>
      input:invalid {
        border: 2px dashed red;
      }

      input:invalid:required {
        background-image: linear-gradient(to right, pink, lightgreen);
      }

      input:valid {
        border: 2px solid black;
      }
    </style>
  </head>

<body>
    <form>
      <label for="choose">Would you prefer a banana or a cherry?</label>
      <input id="choose" name="i_like" required>
      <button>Submit</button>
    </form>
</body>

</html>
